<template>
    <div>
        <h2>角色管理</h2>
        <div class="head">
            <el-button @click="back" size="mini" type="info" class="el-icon-back">
                返回
            </el-button>
        </div>
        <el-form :label-position="labelPosition" label-width="80px" :model="form" style="text-align: left;margin-left: 10px;padding-bottom: 10px;">
            <el-form-item label="名称" style="font-weight: bolder;display: inline-block;width: 600px;margin-right: 30px;">
                <el-input v-model="form.roleName"></el-input>
            </el-form-item>
            <el-form-item label="权限值" style="font-weight: bolder;display: inline-block;width: 600px;">
                <el-input v-model="form.value"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button @click="addName" type="primary">保存</el-button>
                <el-button @click="back">取消</el-button>
            </el-form-item>
            
        </el-form>

    </div>
</template>

<script>
    export default {
        name:'addName',
        data() {
            return {
                labelPosition: 'top',
                form: {
                    roleName: '',
                    value: '',
                },
                userData:[
                    {
                        ID:1,//id
                        name:'超级管理员',//门诊编号
                        value:'100',//权限值
                    }, 
                    {
                        ID:2,//id
                        name:'院长',//门诊编号
                        value:'90',//权限值
                    },
                    {
                        ID:3,//id
                        name:'主任',//门诊编号
                        value:'80',//权限值
                    },
                    {
                        ID:4,//id
                        name:'秘书',//门诊编号
                        value:'60',//权限值
                    },
                    {
                        ID:5,//id
                        name:'助理',//门诊编号
                        value:'20',//权限值
                    },
                ]
            }
        },
        created(){
            
        },
        methods: {
            back(){
                this.$router.push('roleList');
            },
            addName(){
                this.$axios({
                    method:'post',
                    url:'/systemManagement/roleCompany/addRole',
                    data:{
                        roleName:this.form.roleName,
                        value:this.form.value
                    }
                })
                .then(resp=>{
                    console.log(resp.data);
                    this.back();
                })
            }
        },
    }
</script>

<style lang="less" scoped>
    h2{
        text-align: left;
        margin: 10px;
    }
    .head{
        display: flex;
        margin: 5px;
        padding: 10px;
        height: 30px;
        border-top: 5px solid gainsboro;
        border-radius: 5px;
        background-color: white;
    }
    .my_btn{
        display: block;
        justify-content: flex-start;
        align-items: flex-start;
    }
</style>